
if ((window.navigator.userAgent.indexOf("Chrome") !== -1) || (window.navigator.userAgent.indexOf("Safari") >= 0 && navigator.userAgent.toLowerCase().indexOf("version") >= 0)) {
	// alert(navigator.mimeTypes['application/x-shockwave-flash']);
	if(navigator.mimeTypes['application/x-shockwave-flash'] != undefined) {
			var desc = navigator.mimeTypes['application/x-shockwave-flash'].description.toLowerCase();
		    if(desc.indexOf('adobe') > -1) {
		    	bootbox.alert("请下载Chrome/Safari或直接用Chrome/Safari打开!&nbsp;&nbsp;（&nbsp;<a href='http://w.x.baidu.com/alading/anquan_soft_down_b/14744'>Chrome下载</a>&nbsp;/&nbsp;<a href='http://w.x.baidu.com/alading/anquan_soft_down_b/12966'>Safari下载</a>&nbsp;）", function(result) {
		    		window.opener = null;

		    		window.open('', '_self');

		    		window.close();
		    	});
		    }else{
		    	$('#loginBtn').removeAttr('disabled');
		    }
	}else{
		$('#loginBtn').removeAttr('disabled');
	}
	
       
} else {
	bootbox.alert("请下载Chrome/Safari或直接用Chrome/Safari打开!&nbsp;&nbsp;（&nbsp;<a href='http://w.x.baidu.com/alading/anquan_soft_down_b/14744'>Chrome下载</a>&nbsp;/&nbsp;<a href='http://w.x.baidu.com/alading/anquan_soft_down_b/12966'>Safari下载</a>&nbsp;）", function(result) {
		window.opener = null;

		window.open('', '_self');

		window.close();
	});
}


var show_box = function show_box(id) {
	$('.widget-box.visible').removeClass('visible');
	$('#' + id).addClass('visible');
};


$('#loginForm').validate({
	errorElement: 'div',
	errorClass: 'errClass',
	focusInvalid: false,
	rules: {
		username: {
			required: true,
			minlength: 4,
			maxlength: 20,
		},
		password: {
			required: true,
		}
	},
	highlight: function(e) {
		// console.info($(e).closest('.errClass'));
		$(e).closest('.errClass').removeClass('success').addClass('error');
	},

	success: function(e) {
		$(e).closest('.errClass').removeClass('error').addClass('success');
		$(e).remove();
	},

	errorPlacement: function(error, element) {
		error.appendTo(element.parent());
	},

	messages: {
		username: {
			required: "用户名不能为空.",
			minlength: "用户名长度小于4.",
		},
		password: {
			required: "密码不能为空.",
		}
	}
});

// $("#registerForm").validate({
// 	rules: {
// 		email : {
// 			required: true,
// 		},
// 		username : {
// 			required: true,
// 			minlength: 3,
// 			remote: { 
// 				url: "/username", //url地址 
// 				type: "post", //发送方式 
// 				dataType: "json", //数据格式 
// 				data: { //要传递的数据 
// 						username: function() { 
// 						return $("#username").val(); 
// 					}
// 				}
// 			} 
// 		},
// 		password: {
// 			required: true,
// 			minlength: 5
// 		},
// 		password2: {
// 			required: true,
// 			minlength: 5,
// 			// equalTo: "#password"
// 		}
// 	},

// 	errorPlacement: function(error, element) {
// 		error.appendTo(element.parent());
// 	},

// 	messages: {
// 		email: "邮箱不能为空",
// 		username: {
// 			required: "用户名不能为空",
// 			minlength: "用户名长度小于3",
// 			remote: "用户已存在"
// 		},
// 		password: {
// 			required: "密码不能为空",
// 			minlength: "密码长度小于5"
// 		},
// 		password2: {
// 			required: "没有确认密码",
// 			minlength: "确认密码不能小于5个字符"
// 			// equalTo: "两次输入密码不一致"
// 		}
// 	}

// });